Skip to content

Comments

floor rendering fix#48

Open
zZeck wants to merge 1 commit intoLTCHIPS:masterfrom
zZeck:floor-fix
Open

floor rendering fix#48
zZeck wants to merge 1 commit intoLTCHIPS:masterfrom
zZeck:floor-fix

Conversation

@zZeck
Copy link

@zZeck zZeck commented Apr 11, 2021

The original code has insufficient precision in the xstep and ystep used for floor/ceiling. This lack of precision results in very visible error accumulating as DrawRow renders left to right. Look at the distortion on the right side in the original.
Original
floorDistorted
Improved
floorFixed

Credit to a 2019 Kaiser tweet for pointing out the problem.

It would be nice if #42 went in ahead of this. I did a hackier work around the same mingw-w64 problem for w_wad.c.

while (count--) {
/* extract the x/y coordinates */
coord = ((frac >> (32-7)) | ((frac >> (32-23)) << 7)) & 16383;
coord = ((yfrac >> 24) & 0b00000001111111) | (( xfrac >> 17) & 0b11111110000000);
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Binary constants are not standard C, but it makes the code easier to understand. I can change this if needed.

@Calinou
Copy link

Calinou commented Nov 2, 2021

I can confirm this PR works as expected:

image

@zZeck
Copy link
Author

zZeck commented Nov 2, 2021

In hindsight, I should have made the comparison images on a level with straight lines in the floor texture. Thanks for vouching for the PR. Planning on doing anything else in ROTT?

@Calinou
Copy link

Calinou commented Nov 2, 2021

Planning on doing anything else in ROTT?

I don't have much in mind right now, but maybe I'll contribute QOL improvements in the future 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants